/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is Forte for Java, Community Edition. The Initial * Developer of the Original Code is Sun Microsystems, Inc. Portions * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javadoc.comments; import org.openide.src.MemberElement; import org.openide.src.ConstructorElement; import org.openide.src.MethodParameter; import org.openide.src.JavaDocTag; import org.openide.src.JavaDocSupport; /** * * @author * @version */ public class ParamTagPanel extends TagPanel { private static final String cardName = "CRD_PARAM"; // NOI18N static final long serialVersionUID =-8780867931455925203L; /** Initializes the Form */ public ParamTagPanel( MemberElement element, JavaDocEditorPanel editorPanel ) { super( editorPanel ); initComponents (); if ( element instanceof ConstructorElement ) { MethodParameter params[] = ((ConstructorElement)element).getParameters(); for( int i = 0; i < params.length; i++ ) { parameterComboBox.addItem( params[i].getName() ); } parameterComboBox.setSelectedItem( "" ); // NOI18N } addHTMLComponent( descriptionTextArea ); editorPanel.registerComponent( descriptionTextArea ); parameterComboBox.getEditor().getEditorComponent().addFocusListener( new java.awt.event.FocusAdapter () { public void focusLost (java.awt.event.FocusEvent evt) { commitTagChange(); } }); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents jLabel2 = new javax.swing.JLabel (); parameterComboBox = new javax.swing.JComboBox (); jLabel1 = new javax.swing.JLabel (); descriptionScrollPane = new javax.swing.JScrollPane (); descriptionTextArea = new javax.swing.JEditorPane (); setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints1; jLabel2.setText (org.openide.util.NbBundle.getBundle(ParamTagPanel.class).getString("CTL_ParamTagPanel.jLabel2.text")); jLabel2.setHorizontalAlignment (javax.swing.SwingConstants.LEFT); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 1); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (jLabel2, gridBagConstraints1); parameterComboBox.setMaximumRowCount (4); parameterComboBox.setEditable (true); parameterComboBox.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { parameterComboBoxActionPerformed (evt); } } ); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets (2, 1, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (parameterComboBox, gridBagConstraints1); jLabel1.setText (org.openide.util.NbBundle.getBundle(ParamTagPanel.class).getString("CTL_ParamTagPanel.jLabel1.text")); jLabel1.setHorizontalAlignment (javax.swing.SwingConstants.LEFT); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 1); gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST; add (jLabel1, gridBagConstraints1); descriptionTextArea.setContentType ("text/html"); // NOI18N descriptionTextArea.addFocusListener (new java.awt.event.FocusAdapter () { public void focusGained (java.awt.event.FocusEvent evt) { descriptionTextAreaFocusGained (evt); } public void focusLost (java.awt.event.FocusEvent evt) { descriptionTextAreaFocusLost (evt); } } ); descriptionScrollPane.setViewportView (descriptionTextArea); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.gridheight = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets (2, 1, 2, 2); gridBagConstraints1.weightx = 1.0; gridBagConstraints1.weighty = 1.0; add (descriptionScrollPane, gridBagConstraints1); }//GEN-END:initComponents private void descriptionTextAreaFocusGained (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTextAreaFocusGained enableHTMLButtons( true ); }//GEN-LAST:event_descriptionTextAreaFocusGained private void descriptionTextAreaFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTextAreaFocusLost enableHTMLButtons( false ); commitTagChange(); }//GEN-LAST:event_descriptionTextAreaFocusLost private void parameterComboBoxActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_parameterComboBoxActionPerformed // Add your handling code here: }//GEN-LAST:event_parameterComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel2; private javax.swing.JComboBox parameterComboBox; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane descriptionScrollPane; private javax.swing.JEditorPane descriptionTextArea; // End of variables declaration//GEN-END:variables void setData( JavaDocTag tag ) { parameterComboBox.getEditor().setItem( ((JavaDocTag.Param)tag).parameterName() ); descriptionTextArea.setText( ((JavaDocTag.Param)tag).parameterComment() ); descriptionTextArea.setCaretPosition( 0 ); } JavaDocTag getTag( String tagName ) { return JavaDocSupport.createParamTag( tagName, parameterComboBox.getEditor().getItem().toString() + " " + // NOI18N descriptionTextArea.getText() ); }; String getCardName() { return cardName; } void grabFirstFocus() { parameterComboBox.grabFocus(); } } /* * Log * 9 Gandalf 1.8 1/12/00 Petr Hrebejk i18n * 8 Gandalf 1.7 1/3/00 Petr Hrebejk Bugfix 4972 * 7 Gandalf 1.6 1/3/00 Petr Hrebejk Various bugfixes - 4709, * 4978, 5017, 4981, 4976, 5016, 4740, 5005 * 6 Gandalf 1.5 11/27/99 Patrik Knakal * 5 Gandalf 1.4 11/10/99 Petr Hrebejk Workaround for catching * the mnemonics of HTML tag buttons * 4 Gandalf 1.3 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 3 Gandalf 1.2 9/16/99 Petr Hrebejk Tag descriptions editing * in HTML editor + localization * 2 Gandalf 1.1 8/13/99 Petr Hrebejk Window serialization * added & Tag change button in Jdoc editor removed * 1 Gandalf 1.0 7/9/99 Petr Hrebejk * $ */